1. Field of the Invention
The invention relates to computer systems, and more particularly to the management of large objects (hereinafter xe2x80x9cLOBxe2x80x9d or xe2x80x9cLOBsxe2x80x9d) in a database system.
2. Background
Multiple durations can be maintained on a system, in which the durations have different and possibly overlapping lifetimes. The circumstances that mark the end of a duration can be based upon any system criteria or event. For example, the duration time period can be based upon the state of a user""s session or work in the database system. The duration time period can also be based upon a logical timer mechanism, in which a specified period of elapsed time or occurrence of a time value will trigger the termination of a duration. The duration end can also be event driven such that the duration has an indeterminate lifetime based upon the occurrence of a specified event. More details regarding details of durations and duration-based management of objects is described in co-pending U.S. Appl. Ser. No. 09/103,547, entitled xe2x80x9cDuration-Based Memory Management Of Complex Objects,xe2x80x9d filed on Jun. 24, 1998, which is hereby incorporated by reference in its entirety. for the temporary LOB. Index entries may also be maintained to index the contents or the data pages of the temporary LOB. Depending upon the specific purposes for which the temporary LOB is utilized, additional resources or data structures may also be allocated or associated with the temporary LOB.
When a temporary LOB is no longer needed or when it is at the end of its specified lifetime, the resources allocated to the temporary LOB should be deallocated or xe2x80x9cfreedxe2x80x9d to allow re-use of those resources for other purposes. To perform deallocation of the temporary LOBs, the database system must track the existence and location of all temporary LOBs on the system, as well as any resources associated or allocated to the temporary LOBs.
One approach that can be used is to require a user to explicitly track each temporary LOB that has been created by or for that user. The user is given information regarding the pointers or locators for each temporary LOB associated with that user. Under this approach, temporary LOBs are freed by having users make explicit calls to deallocate unneeded LOBs. In this manner, a user can determine exactly when and under what circumstances a temporary LOB will be freed.
One drawback to this approach is that it places a great burden upon the user to track and verify that unneeded temporary LOBs and their resources are deallocated. If the user fails to diligently monitor for temporary LOBs that have exceeded intended lifespans, then excess resources are being consumed on the system. Moreover, since the user is making explicit calls to free each individual temporary LOB, if multiple temporary LOBs having the same lifespan must be freed at the same time, the user is nonetheless forced to repetitively make the same explicit calls for each temporary LOB. In addition, significant resources may have to be expended, both by the user and system, to track each individual temporary LOB on the system.
According to an alternate approach, temporary LOBs are automatically terminated when the database shuts down or when a user session ends. The advantage of this approach is that it does not depend upon the user to perform the explicit task of removing unneeded temporary LOBs. However, this approach allows very little control over the lifespans of individual temporary LOBs. Moreover, temporary LOBs that are unneeded prior to the end of the default lifespan will unnecessarily consume system resources.
Therefore, there is a need for an improved method and mechanism for maintaining, tracking, and freeing temporary LOBs in a database system.
The invention is directed to a method and mechanism for duration-based management of temporary LOBs in a database system. According to an aspect of the invention, temporary LOBs are associated with a duration having a lifespan that corresponds to the lifespan of the temporary LOBs. When the duration ends, the temporary LOBs and any resources allocated to the temporary LOBs are automatically released. According to another aspect of the invention, multiple durations of varying, and possibly overlapping lifespans, can exist in the database system. According to yet another aspect of the invention, a tree of durations can be created having multiple ancestor and descendant durations.
Further details of aspects, objects, and advantages of the invention are described below in the detailed description, drawings, and claims.